const {exec,escape}=require('../db/mysql.js')

const login=async (username,password)=>{
    username=escape(username);
    password=escape(password);
    const sql=`select username,realname from user where username=${username} and password=${password}`;
    const data=await exec(sql);
    return data[0] || {}; //{}还是得有的，不然错误时会报错
}


module.exports={
    login
}